package com.fyy.utils.listener;

import com.fyy.utils.string.SystemOut;
import org.apache.commons.io.monitor.FileAlterationListenerAdaptor;
import org.apache.commons.io.monitor.FileAlterationObserver;

import java.io.File;

public class FileListener extends FileAlterationListenerAdaptor {

    private SystemOut systemOut;

    public FileListener(SystemOut systemOut){
        this.systemOut = systemOut;
    }

    @Override
    public void onStart(FileAlterationObserver observer) {

    }

    @Override
    public void onFileCreate(File file) {
        System.out.println("文件创建" + file.getName());
    }

    @Override
    public void onFileChange(File file) {
        System.out.println("文件修改" + file.getName());
    }

    @Override
    public void onFileDelete(File file) {
        System.out.println("文件删除" + file.getName());
    }

    @Override
    public void onStop(FileAlterationObserver observer) {
        super.onStop(observer);
    }
}
